package com.hsogoo.study.springmvc.boot;

import com.hsogoo.study.springmvc.repository.ConfigurationRepository;
import org.apache.catalina.WebResourceRoot;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.core.StandardContext;
import org.apache.catalina.startup.Tomcat;
import org.apache.catalina.webresources.DirResourceSet;
import org.apache.catalina.webresources.StandardRoot;

import java.io.File;

/**
 * @Author huangsaigang
 * Created @2019-09-27.
 */
public class MySpringApplication {

    public static void run(Class clazz) throws Exception{

        ConfigurationRepository.register(clazz.getName(), clazz);

        Tomcat tomcat = new Tomcat();

        tomcat.setPort(8080);

        tomcat.addWebapp("/", "/Users/huangsaigang");
        Connector connector = tomcat.getConnector();
        connector.setURIEncoding("UTF-8");
        tomcat.setConnector(connector);
        tomcat.start();

        tomcat.getServer().await();


    }
}
